import { defHttp } from '/@/utils/http/axios'
import { AffectedRowsResultModel, UserParams, UserResultModel, UserIdParam, UserResultListModel } from '/@/api/learningcorner/model/userModel';


enum Api {
  AddUser = '/demo/simple/adduser',
  GetById = '/demo/query/getById',
  GetAll = '/demo/query/getAll',
  Delete = '/demo/delete',
  Update = '/demo/update'
}

export const getUserByIdApi = (id:String) => {
  return defHttp.get<UserResultModel>({
    url:Api.GetById,
    params:id
  })
};
export const AddUser=(user:any) => {
  return defHttp.post<AffectedRowsResultModel>({
    url:Api.AddUser,
    params:user
  })
};
export const UpdateUser = (user:any) =>{
  return defHttp.post<AffectedRowsResultModel>({
    url:Api.Update,
    params:user,
  })
};
export const  GetAll = ()=>{
  return defHttp.get<UserResultListModel>({
    url:Api.GetAll,
  })
};
export const Delete=(id:string)=>{
  return defHttp.get<AffectedRowsResultModel>({
    url:Api.Delete,
    params:id
  })
};
